import React from 'react';
import { useParams } from 'react-router-dom';
import TradeRule from './strategy/TradeRule.tsx';
import MarketConsensus from './strategy/MarketConsensus.tsx';

import StateWave from './strategy/StateWave.tsx';
import StateLeader from './strategy/StateLeader.tsx';
import StateArbitrage from './strategy/StateArbitrage.tsx';
import StateValue from './strategy/StateValue.tsx';


import StockSelectionStrategy from './strategy/StockSelectionStrategy.tsx';
import BuyStrategy from './strategy/BuyStrategy.tsx';
import SellStrategy from './strategy/SellStrategy.tsx';
import PositionStrategy from './strategy/PositionStrategy.tsx';


import MindMethod from './strategy/MindMethod.tsx';
import Concept from './strategy/Concept.tsx';
import EssaySet from './strategy/EssaySet.tsx';
import Feature from './strategy/Feature.tsx';

const ManipulateStrategy = () => {
  const { subpage } = useParams();
  
  // 如果没有二级页面参数，使用默认值
  const currentSubpage = subpage || 'stock-selection-strategy';
  
  const getPageTitle = () => {
    switch(currentSubpage) {
      case 'trade-rule': return '交易规则';
      case 'market-consensus': return '市场共识';
      case 'state-wave': return '波段复利';
      case 'state-leader':return '主线龙头';
      case 'state-arbitrage': return '投机套利';
      case 'state-value': return '价值低吸';
      case 'stock-selection-signal': return '选股信号';
      case 'buy-strategy': return '买入节点';
      case 'sell-strategy': return '卖出标准';
      case 'position-strategy': return '仓位策略';
      case 'concept': return '概念篇';
      case 'mind-method': return '心法篇';
      case 'feature': return '特征篇';
      case 'essay-set': return '文章集';
      case 'stock-positioning': return '选股定位';

      default: return '交易策略';
    }
  };
  
  const getPageContent = () => {
    switch(currentSubpage) {
      case 'trade-rule': return <TradeRule />;
      case 'market-consensus': return <MarketConsensus />;
      case 'state-wave': return <StateWave />;
      case 'state-leader': return <StateLeader />;
      case 'state-arbitrage': return <StateArbitrage />;
      case 'state-value': return <StateValue />;

      case 'stock-selection-strategy': return <StockSelectionStrategy />;
      case 'buy-strategy': return <BuyStrategy />;
      case 'sell-strategy': return <SellStrategy />;
      case 'position-strategy': return <PositionStrategy />;

      case 'concept': return <Concept />;
      case 'mind-method': return <MindMethod />;
      case 'feature': return <Feature />;
      case 'essay-set': return <EssaySet />;
      
      default: return <p>请从左侧选择策略类型</p>;
    }
  };

  return (
    <div className="page-container">
      <h2>{getPageTitle()}</h2>
      {getPageContent()}
    </div>
  );
};

export default ManipulateStrategy;